package treazy.ultimate.stats;

import android.app.ActionBar;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class TeamActivity extends Activity {
	protected String teamName = null;
	private Button viewRoster;
	//private Button viewTeams;
	
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	    setContentView(R.layout.team);
	    
		ActionBar actionBar = getActionBar();
	    actionBar.setDisplayHomeAsUpEnabled(true);
	    
	    Team team = new Team();
	    Bundle extras = getIntent().getExtras();
	    if (extras != null) {
	        teamName = extras.getString("TeamName");
	        team.setName(teamName);
	    }
	    TextView nameText = (TextView)findViewById(R.id.teamname);
	    nameText.setText(team.getName());
	    
	    viewRoster = (Button)findViewById(R.id.viewroster);
	    viewRoster.setOnClickListener(new View.OnClickListener() {
			public void onClick(View v){
				Intent i = new Intent(getApplicationContext(), ViewRosterActivity.class);
				i.putExtra("TeamName", teamName);
				startActivity(i);
			}
		});
	    
//	    viewTeams = (Button)findViewById(R.id.viewteamsbutton);
//	    viewTeams.setOnClickListener(new View.OnClickListener() {
//			public void onClick(View v){
//				startActivity(new Intent(getApplicationContext(), ViewTeamsActivity.class));	
//			}
//		});
	    
	}
	
	@Override 
	public boolean onCreateOptionsMenu(Menu menu) {
	    MenuInflater inflater = getMenuInflater();
	    inflater.inflate(R.menu.generalmenu, menu);
	    return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
	    // Handle item selection
	    switch (item.getItemId()) {
	        case android.R.id.home:
	        	startActivity(new Intent(getApplicationContext(), ViewTeamsActivity.class));
	        	return true;
	        default:
	            return super.onOptionsItemSelected(item);
	    }
	}
	
	

}
